/*
网站管理员Store，超级客服，拥有所有权限
*/

import { defineStore } from "pinia";
import type { Ref } from "vue";
import { computed, ref } from "vue";

import type {
  IWebsite,
  
  IWebsiteService,
  ICustomer,

  IConversation,
  IConversationRelation,
} from "@src/types";

const userServiceStore = defineStore("userServiceStore", () => {

  //来自url的用户id，可能是随机的，也可能是第三方的，发送给服务端后，服务端可能会进行修改，比如匹配到了关联的id
  const customerId = ref('');
  // app data refs
  // data refs
  const services: Ref<Record<string,IWebsiteService>> = ref({});
  const customers: Ref<Record<string,ICustomer>> = ref({});
  const website: Ref<IWebsite | undefined> = ref(undefined);
  const conversations: Ref<IConversation[]> = ref([]);
  const conversationRelations: Ref<IConversationRelation[]> = ref([]);

  return {
    customerId,
    services,
    website,
    conversations,
    customers,
    conversationRelations
  };
});

export default userServiceStore;
